﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace AzukiMapUI
{
    public class DialogOpener
    {

        public DialogOpener()
        {
        }

        public void OpenDialog(UIElement element)
        {
            Grid layoutRoot = ((Page)App.Current.RootVisual).LayoutRoot;
            int numOfRows = layoutRoot.ColumnDefinitions.Count + 1;
            int numOfCols = layoutRoot.RowDefinitions.Count;
            element.SetValue(Grid.RowSpanProperty, numOfRows);
            element.SetValue(Grid.ColumnSpanProperty, numOfCols);
            element.SetValue(Grid.HorizontalAlignmentProperty, HorizontalAlignment.Left);
            element.SetValue(Grid.VerticalAlignmentProperty, VerticalAlignment.Top);

            layoutRoot.Children.Add(element);
        }
    }
}
